Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable underscore integer separation for decimal values (ints) #204

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

marcules
Copy link
Contributor

@marcules marcules commented Jan 1, 2023

This fixes #202

Checklist

  • Add test cases to all the changes you introduce
  • Update the documentation for the changes

@marcules marcules force-pushed the feature/underscore-for-decimal-numbers branch from a150cc0 to dc84450 Compare January 1, 2023 22:01
@coveralls
Copy link

coveralls commented Jan 1, 2023

Pull Request Test Coverage Report for Build 3818872307

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 9 of 11 (81.82%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 99.297%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/yamlfix/adapters.py 8 10 80.0%
Totals Coverage Status
Change from base Build 3787161522: -0.5%
Covered Lines: 424
Relevant Lines: 427

💛 - Coveralls

Copy link
Owner

@lyz-code lyz-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for your time. I'd simply add another test to be sure


result = fix_code(source, config)

assert result == fixed_source
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure I'd add a test where the source has underscores, the config is set to undersscore_integer = False and make sure that the reverse procedure works well too

        fixed_source = dedent(
            """\
            small_ints: [1, 10, 100]
            big_ints: [1000, 10000, 1000000, 100000000000000000000]
            """
        )
        source = dedent(
            """\
            ---
            small_ints: [1, 10, 100]
            big_ints: [1_000, 10_000, 1_000_000, 100_000_000_000_000_000_000]
            """  # noqa: E501
        )

        config = YamlfixConfig()
        result = fix_code(source, config)
        assert result == fixed_source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to add underscore thousands separators to numeric values
3 participants